package com.ruiysoft.controller.logistics;

import com.ruiysoft.controller.logistics.vo.ExpressInfo;
import com.ruiysoft.entity.logistics.APILogisticsMessage;
import com.ruiysoft.pub.core.Result;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import java.util.List;
import java.util.Map;

@Api(value = "logistics", description = "the logistics API")
@RequestMapping("/logistics")
public interface LogisticsApi {

    /**
     * 获取所有快递公司
     * @return
     */
    @RequestMapping(value = "/expresscom",method = RequestMethod.GET)
    Result<List<ExpressInfo.ExpressCompany>> expresscom();

    /**
     * 快递回调
     * @param apiSupplier
     * @param shopID
     * @param param
     * @return
     */
    @RequestMapping(value = "/callback/{apiSupplier}/{shopID}",method = RequestMethod.POST)
    Map<String,Object> logisticsCallBack(@PathVariable("apiSupplier") String apiSupplier,
                                         @PathVariable("shopID") Long shopID,
                                         @RequestBody String param);

    /**
     * 获取物流信息
     * @param expressNO 快递单号
     * @param expressCom 快递公司编码（可以为空，不推荐为空）
     * @return
     */
    @RequestMapping("/message")
    Result<APILogisticsMessage> getExpressMessage(String expressNO,String expressCom);

    /**
     * 给快递单匹配快递公司信息
     * 给快递单匹配快递公司信息
     * @param expressNO
     * @return
     */
    @RequestMapping("/getexpressinfo")
    Result<ExpressInfo> getExpressInfo(String expressNO);

    /**
     * 检查此快递公司编码和快递单号是否匹配
     * @param expressCom
     * @param expressNO
     * @return
     */
    @RequestMapping("/validate")
    Result<Boolean> validate(String expressCom,String expressNO);

    /**
     *
     * @param expressNO
     * @param expressCom
     * @return
     */
    Result<Boolean> isChecked(String expressNO,String expressCom);

    // 物流信息写错时候，修改物流公司编码和快递单号
    @RequestMapping(value = "/modify",method = RequestMethod.GET)
    Result<Boolean> modify(Integer id, String enterpriseName, String enterpriseCode, String logisticsNo);

}
